Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship

نویسندگان

  • Graylin Jay
  • Joanne E. Hale
  • Randy K. Smith
  • David P. Hale
  • Nicholas A. Kraft
  • Charles Ward
چکیده

Researchers have often commented on the high correlation between McCabe’s Cyclomatic Complexity (CC) and lines of code (LOC). Many have believed this correlation high enough to justify adjusting CC by LOC or even substituting LOC for CC. However, from an empirical standpoint the relationship of CC to LOC is still an open one. We undertake the largest statistical study of this relationship to date. Employing modern regression techniques, we find the linearity of this relationship has been severely underestimated, so much so that CC can be said to have absolutely no explanatory power of its own. This research presents evidence that LOC and CC have a stable practically perfect linear relationship that holds across programmers, languages, code paradigms (procedural versus object-oriented), and software processes. Linear models are developed relating LOC and CC. These models are verified against over 1.2 million randomly selected source files from the SourceForge code repository. These files represent software projects from three target languages (C, C++, and Java) and a variety of programmer experience levels, software architectures, and development methodologies. The models developed are found to successfully predict roughly 90% of CC’s variance by LOC alone. This suggest not only that the linear relationship between LOC and CC is stable, but the aspects of code complexity that CC measures, such as the size of the test case space, grow linearly with source code size across languages and programming paradigms.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A critique of cyclomatic complexity as a software metric

McCabe’s cyclomatic complexity metric is widely cited a s a useful predictor of various software attributes such a s reliability and development effort. This critique demonstrates that it is based upon poor theoretical foundations and an inadequate model of software development. The argument that the metric provides the developer with a useful engineering approximation is not borne out by the e...

متن کامل

An Empirical Evaluation of Impact of Refactoring On Internal and External Measures of Code Quality

Refactoring is the process of improving the design of existing code by changing its internal structure without affecting its external behaviour, with the main aims of improving the quality of software product. Therefore, there is a belief that refactoring improves quality factors such as understandability, flexibility, and reusability. However, there is limited empirical evidence to support suc...

متن کامل

Empirical analysis of the relationship between CC and SLOC in a large corpus of Java methods and C functions

Measuring the internal quality of source code is one of the traditional goals of making software development into an engineering discipline. Cyclomatic Complexity (CC) is an often used source code quality metric, next to Source Lines of Code (SLOC). However, the use of the CC metric is challenged by the repeated claim that CC is redundant with respect to SLOC due to strong linear correlation. W...

متن کامل

Impact of Unanticipated software evolution on development cost and quality: an empirical evaluation

Most techniques to aid maintenance and evolution of software require to define extension points. Generally, developers try to anticipate the parts that are more likely to evolve, but they can make mistakes and spend money in vain. With Unanticipated Software Evolution, developers can easily change any element of the software, even those that are not related with an extension point. However, we ...

متن کامل

Reliability and maintainability related software coupling metrics in C++ programs

This paper describes some difficulties that one encounters in the testing and maintenance of C++ programs, which may result in program unreliability. Inheritance and polymorphism are key concepts in objectoriented programming (OOP), and are essential for achieving reusability and extendibility, but they also make programs more difficult to understand. We have tried to show by arguments and by s...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • JSEA

دوره 2  شماره 

صفحات  -

تاریخ انتشار 2009